package com.ktgj.pay.mapper;

import com.ktgj.pay.domain.MoInvoice;
import com.ktgj.pay.domain.MoInvoiceHistory;
import com.ktgj.pay.domain.MoInvoiceList;
import com.ktgj.pay.domain.MoInvoiceMQPush;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface InvoiceMapper {

	/**
	 * 获取发票信息
	 * @param invoiceID  发票信息主键id
	 * @param orderNum	   发票业务线订单id
	 * @return
	 */
	MoInvoice getInvoice(@Param("invoiceID") Long invoiceID, @Param("orderNum")String orderNum, @Param("subOrders")String subOrders);
	/**
	 * 获取开票历史
	 * @param orderNum
	 * @return
	 */
	List<MoInvoiceHistory> getInvoiceHistory(@Param("orderNum")String orderNum);
	/**
	 * 获取开票详情-App
	 * @param orderNum
	 * @return
	 */
	List<MoInvoiceList> getInvoiceForApp(@Param("orderNum")String orderNum, @Param("sourceWay")int sourceWay);
	/**
	 * 获取开票信息-消息队列
	 * @param invoiceID
	 * @param state
	 * @return
	 */
	MoInvoice getInvoiceForMQ(@Param("invoiceID")int invoiceID,@Param("state")int state);
	/**
	 * 批量获取待推送数据
	 * @param invoiceID
	 * @param imgurl
	 * @return
	 */
	List<MoInvoiceMQPush> getInvoicePushs(@Param("invoiceID")int invoiceID, @Param("imgurl")String imgurl);
	/**
	 * 根据电子票配送状态，获取发票信息
	 * @param invoiceID
	 * @param emailState
	 * @return
	 */
	MoInvoiceMQPush getInvoiceMQPush(@Param("invoiceID")int invoiceID,@Param("emailState")int emailState);
	/**
	 * 新增发票信息，返回主键id
	 * @param invoice
	 * @return
	 */
	int insertInvoice(@Param("invoice")MoInvoice invoice);
	/**
	 * 更新开票信息
	 * @param invoice
	 * @return
	 */
	int updInvoice(@Param("invoice")MoInvoice invoice);
	/**
	 * 回填更新发票下载信息
	 * @param invoice
	 * @return
	 */
	int updInvoiceMQ(@Param("invoice")MoInvoiceMQPush invoice);
	/**
	 * 业务线，修改开票记录状态
	 * @param sourceWay
	 * @param orderNum
	 * @param subOrders
	 * @param state
	 * @param JSJID
	 * @return
	 */
	int updInvoiceState(@Param("sourceWay")int sourceWay,@Param("orderNum")String orderNum,@Param("subOrders")String subOrders,@Param("state")int state,@Param("JSJID")String JSJID,@Param("invoiceID")int invoiceID);
	/**
	 * 业务线-修改开票信息-定时处验证
	 * @param push
	 * @return
	 */
	int updInvoiceByBusiness(@Param("push")MoInvoiceMQPush push);

	
}
